package com.zqq.user.service.impl

import com.zqq.baselibrary.http.rx.BaseException
import com.zqq.baselibrary.http.rx.BaseResp
import com.zqq.user.service.UserService
import com.zqq.user.service.bean.UserInfo
import com.zqq.user.service.respository.UserRepository
import rx.Observable
import rx.functions.Func1
import javax.inject.Inject

/**
 *  //测试限定符
 * @author zqq on 2018/7/26
 */
class UserServiceImpl2 @Inject constructor(): UserService {

    @Inject
    lateinit var repository: UserRepository

    //1.用户注册
    override fun register(mobile: String, pwd: String, verifyCode: String): Observable<Boolean> {
        return repository.register(mobile, pwd, verifyCode)
                .flatMap(object : Func1<BaseResp<String>, Observable<Boolean>> {
                    override fun call(t: BaseResp<String>): Observable<Boolean> {
                        if (t.status !== 0) {
                            return Observable.error(BaseException(0, "ss"))
                        }
                        return Observable.just(true)
                    }
                })
    }


    override fun login(mobile: String, pwd: String, pushId: String): Observable<UserInfo> {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun editUser(userIcon: String, userName: String, userGender: String, userSign: String): Observable<UserInfo> {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun forgetPwd(mobile: String, verifyCode: String): Observable<Boolean> {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

    override fun resetPwd(mobile: String, pwd: String): Observable<Boolean> {
        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
    }

}